def is_prime(n):
    if n < 2:
        return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False
    return True

def print_primes(start, end):
    primes = []
    for num in range(start, end + 1):
        if is_prime(num):
            primes.append(num)
    count = 0
    for prime in primes:
        print(prime, end=' ')
        count += 1
        if count % 5 == 0:
            print()
    print()

if __name__ == "__main__":
    start = 1
    end = 20000
    print_primes(start, end)
